{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from sklearn.linear_model import Ridge\n",
    "from sklearn.linear_model import Lasso"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_pl(degree):\n",
    "    return Pipeline([\n",
    "        ('poly',PolynomialFeatures(degree=degree)),\n",
    "        ('std_scaler',StandardScaler()),\n",
    "        ('lr',LinearRegression())\n",
    "    ])\n",
    "\n",
    "def get_pl_r(degree,alpha):\n",
    "    return Pipeline([\n",
    "        ('poly',PolynomialFeatures(degree=degree)),\n",
    "        ('std_scaler',StandardScaler()),\n",
    "        ('lr',Ridge(alpha=alpha))\n",
    "    ])\n",
    "def get_pl_l(degree,alpha):\n",
    "    return Pipeline([\n",
    "        ('poly',PolynomialFeatures(degree=degree)),\n",
    "        ('std_scaler',StandardScaler()),\n",
    "        ('lr',Lasso(alpha=alpha))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=np.linspace(-3.0,3.0,100)\n",
    "X=x.reshape(-1,1)\n",
    "y=x**2 * 0.5 + x  + 1 + np.random.normal(0,1,len(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x1a1f359198>"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFl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hEFWpH01NjXJ5RggMiZme2TdEDSg8O2ZDFmtsvMjkr6mqTPuHvQ8xgscJvZP5rZF6b8uVKS3P197n6BpNslvXuodtYx71x2jnmfpFPaPp8o1TmPRNmU7yX7FJcbM3uppDsl/frE03Yy3P20u79W20/UrzOzoGmswXbAcfc31Tz0byR9StJNAZvTyrxzMbNflvQ2SW/0GAcVdjT4P0nNCUkXjH19vqSnB2oLxuzkhO+UdLu73zV0e9py900z+ydJV0gKNoAcZarEzF499uXbJT0+VFvaMrMrJL1X0tvd/Zmh21OohyS92swuNLPvkHSNpE8O3Kbi7QzqfUjSMXd//9DtWZSZ7RlVi5nZkqQ3KXDMirWq5E5J+7VdxfCkpHe5+/qwrVqMmT0h6Tsl/ffOtz6XYoWMmf2MpD+TtEfSpqSj7n75sK2qz8zeIukDknZJ+rC73zxwkxZiZh+V9AZtr0L3X5JucvcPDdqoBZnZT0r6V0mPaPuzLkm/4+6fHq5VzZnZD0n6K21fW+dI+ri7/0HQ3xlj4AYAVIsyVQIAqEbgBoDEELgBIDEEbgBIDIEbABJD4AaAxBC4ASAxBG4ASMz/A6MgjfXfjLI/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a2296c0f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [],
   "source": [
    "pl1=get_pl_l(200,10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n",
       "     steps=[('poly', PolynomialFeatures(degree=200, include_bias=True, interaction_only=False)), ('std_scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('lr', Lasso(alpha=10, copy_X=True, fit_intercept=True, max_iter=1000,\n",
       "   normalize=False, positive=False, precompute=False, random_state=None,\n",
       "   selection='cyclic', tol=0.0001, warm_start=False))])"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pl1.fit(X,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_predict=pl1.predict(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5.200219282987843"
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mean_squared_error(y_predict,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1a225daa20>]"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGABJREFUeJzt3W+sZdVZx/Hfw+XSXqDtrTKJnQs61NRBLco0N7WKaQpthbS1IGqkWqPxBemLWoqKHWwi/gmCwVQaXxgnocZGbGkKksZWoWbwT0lA7jBjKQzTECowl2ovxRsL3HT+Pb6498CZw9nn7H32Xnuvtfb3k0wy984+56x9Zp/nrP2sZ61l7i4AQDpO6boBAIBqCNwAkBgCNwAkhsANAIkhcANAYgjcAJAYAjcAJIbADQCJIXADQGJODfGkZ511lu/YsSPEUwNAlvbt2/esu28rc2yQwL1jxw6trKyEeGoAyJKZPVn2WFIlAJAYAjcAJIbADQCJIXADQGII3ACQGAI3ACQmSDkgAOTurv2ruvnuQ3pmfUPbFxd07SU7dfmupVZem8ANABXdtX9V1935sDaOHpckra5v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yt1v6LhJMzGzz0h6hzZXofsfSde7+62dNmpGZvbTkv5d0sPa/KxL0u+5+5e6a1V1ZvZjkv5Gm9fWKZI+5+5/FPQ1YwzcAIBiUaZKAADFCNwAkBgCNwAkhsANAIkhcANAYgjcAJAYAjcAJIbADQCJ+X+BLY0vmAZcGQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a225daa90>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)\n",
    "plt.plot(x,y_predict,color='r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
